Repository navigation
Preserve distinct IELR annotation contributions - #876
Merged
Merged
Conversation
ydah
force-pushed
the
fix/preserve-distinct-ielr-annotations
branch
from
November 14, 2026 07:33
69432fd to
1e36764
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OR-merging contribution matrices from different paths can hide differences in their dominant actions. This makes incompatible lookahead sets appear compatible, allowing IELR to merge states that need to remain separate and reject valid input.
Keep distinct contribution matrices and discard only identical annotations, including the originating state, token, and actions. This follows Bison's annotation insertion policy (https://github.com/akimd/bison/blob/v3.8.2/src/AnnotationList.c#L62-L142). Remove the unused matrix-merging method.
Build each receiving state's insertion index once per annotation propagation pass and update it as annotations arrive. Keep the indexes local to that pass so independent calls rebuild them from the current annotations.
Measured on Ruby 4.0.9, arm64 macOS, with YJIT disabled and 12 balanced, randomized comparisons per mode. Before is master at 970b304; After is 69432fd. All values are means. CLI timings include startup and C output generation, excluding reports. Warm measurements follow one warm-up run and
GC.start.CLI elapsed time improves in all 12 comparisons, with a paired mean reduction of 11.8% and a bootstrap 95% interval of 10.6–13.0%. Allocations decrease by 18.4%. Peak RSS increases by 8.7%, and warm GC time shows no clear improvement. The two smaller grammars show no clear overall time change.
The regression parser previously rejected
bbc; it now accepts it. It agrees with Bison 3.8.2's IELR and canonical LR parsers on all 9,841 strings overa,b, andcof length 0–8. All 770 specs pass. A 267-grammar comparison against master changes only the new regression fixture; Ruby'sparse.yproduces identical C and reports.